package apps;

abstract class Account_old
{
    private Agency agency;
    private double balance = 100.0;
    private double limit;
    int number;

    public Account_old(Agency agency)
    {
	this.setAgency(agency);
    }

    public void transfer(Account_old destiny, double value)
    {
	this.setBalance(this.getBalance() - value);
	destiny.setBalance(destiny.getBalance() + value);
    }

    public boolean deposit(double value)
    {
	if (value > 0)
	{
	    this.setBalance(this.getBalance() + value);
	    this.cashRate();
	    return true;
	} else
	    return false;
    }

    public double withdraw(double value)
    {
	if (this.getBalance() > value)
	{
	    this.setBalance(this.getBalance() - value);
	    this.cashRate();
	    System.out.println("Get your money!");
	} else
	    System.out.println("Insuficient funds to withdraw " + value + "!");

	return this.getBalance();
    }

    public abstract void printDetailedStatement();

    /*
     * public void printStatus() { printStatus(15); }
     * 
     * public void printStatus(int days) { System.out.println("Balance: " +
     * this.getBalance()); System.out.println("Limit: " + this.getLimit()); }
     */

    private void cashRate()
    {
	this.setBalance(this.getBalance() - 0.1);
    }

    public void setAgency(Agency agency)
    {
	this.agency = agency;
    }

    public Agency getAgency()
    {
	return agency;
    }

    public void setBalance(double balance)
    {
	this.balance = balance;
    }

    public double getBalance()
    {
	return balance;
    }

    public void setLimit(double limit)
    {
	this.limit = limit;
    }

    public double getLimit()
    {
	return limit;
    }
}
